﻿using Sessionizer.Samples.Model;
using Sessionizer.Samples.Sessionized.Rankers.Database;
using Sessionizer.Samples.Sessionized.Rankers.NameLength;

namespace Sessionizer.Samples.Sessionized.Rankers.Cheater
{
    /// <summary>
    /// This ranker depends on two other rankers and negates its impact on overall rating.
    /// </summary>
    public sealed class CheaterRanker : IRanker
    {
        private readonly DatabaseRanker _databaseRanker;
        private readonly NameLengthRanker _nameLengthRanker;

        public CheaterRanker(
            DatabaseRanker databaseRanker,
            NameLengthRanker nameLengthRanker
            )
        {
            _databaseRanker = databaseRanker;
            _nameLengthRanker = nameLengthRanker;
        }

        public int Rank(ITeam team)
        {
            return -(_databaseRanker.Rank(team) + _nameLengthRanker.Rank(team));
        }
    }
}